/*
 * File      : application.c
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2006, RT-Thread Development Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rt-thread.org/license/LICENSE
 *
 * Change Logs:
 * Date           Author       Notes
 * 2009-01-05     Bernard      the first version
 * 2013-11-15     bright       add init thread and components initial
 */

/**
 * @addtogroup STM32
 */
/*@{*/

#include <stdio.h>

#include <board.h>
#include <rtthread.h>
#include "led.h"

static char led_stack[384];
static struct rt_thread led_thread;

/* led thread entry */
static void led_thread_entry(void* parameter)
{
	while(1)
	{
        rt_hw_led_on();
        rt_thread_delay(RT_TICK_PER_SECOND);

        rt_hw_led_off();
        rt_thread_delay(RT_TICK_PER_SECOND);
	}
}

int rt_application_init()
{
	  rt_err_t result;
	
    result = rt_thread_init(&led_thread,
                            "led",
                            led_thread_entry,
                            RT_NULL,
                            &led_stack[0],
                            sizeof(led_stack),
                            4,
                            2);
    if (result == RT_EOK)
    {
        rt_thread_startup(&led_thread);
    }

    return 0;
}


/*@}*/
